﻿using AutoMapper;
using Sok.Munkae.ApplicationServices;
using Sok.Munkae.ApplicationServices.DTO;
using Sok.Munkae.ApplicationServices.Membership;
using Sok.Munkae.Core;

namespace Sok.Munkae.Web.PresentationServices
{
    public class ProjectPresentationService
    {
        private IProjectService projectService;
        private IUserContext userContext;

        public ProjectPresentationService(IUserContext userContext, IProjectService projectService)
        {
            this.projectService = projectService;
            this.userContext = userContext;
        }

        public ProjectListViewModel ProjectListViewModel()
        {
            var model = new ProjectListViewModel();
            model.ProjectList = projectService.GetProjectList();
            var user = userContext.GetUser();
            model.Organization = Mapper.Map<Organization, OrganizationDTO>(userContext.GetUser().Organization);
            model.CurrentUser = Mapper.Map<User, UserDTO>(userContext.GetUser());
            return model;
        }
    }
}